from pyspark import SparkConf, SparkContext

conf = SparkConf().setAppName("distinct").setMaster("local")
sc = SparkContext(conf=conf)

rdd = sc.parallelize([1, 2, 3, 2, 1, 4, 5, 4, 6, 7, 8, 7, 6, 9, 10])

distinct_rdd = rdd.distinct()

print(distinct_rdd.collect())

sc.stop()